package com.zlx.mall.basic.common.exception;


import com.zlx.mall.basic.common.enums.ResponseEnum;

/**
 * @author qingke
 **/
public class BizExtraRuntimeException extends BaseRuntimeException {

    private static final ResponseEnum DEFAULT_STATUS = BaseResponseStatusEnum.FAILURE;

    private Integer extraCode;
    private String extraMessage;

    public BizExtraRuntimeException(Integer code, String message) {
        super(code, message);
    }

    public BizExtraRuntimeException(Integer code, String message, Throwable cause) {
        super(code, message, cause);
    }

    public BizExtraRuntimeException(ResponseEnum status, ResponseEnum extra) {
        super(status.getCode(), status.getMessage());
        this.extraCode = extra.getCode();
        this.extraMessage = extra.getMessage();
    }

    public BizExtraRuntimeException(Throwable cause) {
        super(DEFAULT_STATUS.getCode(), DEFAULT_STATUS.getMessage(), cause);
    }

    public BizExtraRuntimeException(Throwable cause, Integer extraCode, String extraMessage) {
        super(DEFAULT_STATUS.getCode(), DEFAULT_STATUS.getMessage(), cause);
        this.extraCode = extraCode;
        this.extraMessage = extraMessage;
    }

    public BizExtraRuntimeException(Throwable cause, ResponseEnum extra) {
        super(DEFAULT_STATUS.getCode(), DEFAULT_STATUS.getMessage(), cause);
        this.extraCode = extra.getCode();
        this.extraMessage = extra.getMessage();
    }

    public Integer getExtraCode() {
        return extraCode;
    }

    public String getExtraMessage() {
        return extraMessage;
    }

    public void setExtraCode(Integer extraCode) {
        this.extraCode = extraCode;
    }

    public void setExtraMessage(String extraMessage) {
        this.extraMessage = extraMessage;
    }
}
